package com.thon.entity.project;


import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.springframework.format.annotation.DateTimeFormat;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.thon.entity.system.DicData;
import com.thon.entity.util.IdEntity;

@Entity
@Table(name = "datum")
@JsonIgnoreProperties(ignoreUnknown = true)
public class Data extends IdEntity implements Cloneable  {

	private static final long serialVersionUID = -8544188730815102244L;
	private Double value;
	private DicData type ;
	private Date creatDate;
	private Date ModifyDate;
	private String description;
	

	public Data() {
	}


	public Double getValue() {
		return value;
	}


	public void setValue(Double value) {
		this.value = value;
	}

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name="type_id",nullable = false)
	@JsonIgnoreProperties(value = { "hibernateLazyInitializer", "handler" })
	public DicData getType() {
		return type;
	}


	public void setType(DicData type) {
		this.type = type;
	}

	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
	public Date getCreatDate() {
		return creatDate;
	}


	public void setCreatDate(Date creatDate) {
		this.creatDate = creatDate;
	}

	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")	
	public Date getModifyDate() {
		return ModifyDate;
	}


	public void setModifyDate(Date modifyDate) {
		ModifyDate = modifyDate;
	}


	public String getDescription() {
		return description;
	}


	public void setDescription(String description) {
		this.description = description;
	}

	@Transient
	 public Object clone() {   
	        try {   
	            return super.clone();   
	        } catch (CloneNotSupportedException e) {   
	            return null;   
	        }   
	    }   
	
}